package chapter07_object;

/**
 * ClassName: UserTset
 * Package: chapter07_object
 * Description:
 *
 *this调用构造器
 *
 * @Author SherryA
 * @Create 2025/7/16 18:13
 */
public class UserTset {
    public static void main(String[] args) {

    }
}
class User{

    String name;
    int age;

    User(){

    }
    User(String name){
        this();//调用了User()构造器
        this.name=name;
    }
    User(String name,int age){
        this(name);//调用了User(String name)构造器
        this.name=name;
        this.age=age;
    }
}
